//
//  ProductCategoriesManageCell.m
//  AFNetworking
//
//  Created by admin on 2020/4/29.
//

#import "ProductCategoriesManageCell.h"

@implementation ProductCategoriesManageCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
         [self configUI];
    }
    return self;
}


-(void)configUI{
    self.textLabel.font = FONT_SYS14;
    self.textLabel.textColor = COLOR_33;
    self.backgroundColor = UIColor.whiteColor;
     [self.contentView addSubview:self.countLab];
    [self.contentView addSubview:self.rightArrowImg];
    [self.contentView addSubview:self.editView];
    [self.editView addSubview:self.deleteBtn];
    [self.editView addSubview:self.eidtBtn];
    [self.editView addSubview:self.upBtn];
    [self.editView addSubview:self.downBtn];
}
-(UILabel *)countLab{
    if (!_countLab) {
        _countLab = [UILabel new];
        _countLab.textColor = COLOR_99;
        _countLab.font = FONT_SYS13;
    }
    return _countLab;
}

-(UIImageView *)rightArrowImg{
    if (!_rightArrowImg) {
        _rightArrowImg = [UIImageView new];
        [_rightArrowImg setImage:[UIImage imageWithIcon:@"fa-angle-right" backgroundColor:[UIColor clearColor] iconColor:COLOR_99 andSize:CGSizeMake(20, 20)]];
    }
    return _rightArrowImg;
}
-(UIView *)editView{
    if (!_editView) {
        _editView = [UIView new];
        
        _editView.userInteractionEnabled = YES;
    }
    return _editView;
}
-(UIButton *)downBtn{
    if (!_downBtn) {
        _downBtn = [UIButton new];
        [_downBtn setImage:[UIImage imageWithIcon:@"fa-arrow-down" backgroundColor:UIColor.clearColor iconColor:COLOR_99 andSize:CGSizeMake(KAutoAcale(18), KAutoAcale(18))] forState:UIControlStateNormal];
    }
    return _downBtn;
}
-(UIButton *)eidtBtn{
    if (!_eidtBtn) {
        _eidtBtn = [UIButton new];
         [_eidtBtn setImage:[UIImage imageWithIcon:@"fa-pencil-square-o" backgroundColor:UIColor.clearColor iconColor:COLOR_99 andSize:CGSizeMake(KAutoAcale(18), KAutoAcale(18))] forState:UIControlStateNormal];
      
    }
    return _eidtBtn;
}
-(UIButton *)deleteBtn{
    if (!_deleteBtn) {
        _deleteBtn = [UIButton new];
        [_deleteBtn setImage:[UIImage imageWithIcon:@"fa-trash-o" backgroundColor:UIColor.clearColor iconColor:COLOR_99 andSize:CGSizeMake(KAutoAcale(18), KAutoAcale(18))] forState:UIControlStateNormal];
    }
    return _deleteBtn;
}
-(UIButton *)upBtn{
    if (!_upBtn) {
        _upBtn = [UIButton new];
        [_upBtn setImage:[UIImage imageWithIcon:@"fa-arrow-up" backgroundColor:UIColor.clearColor iconColor:COLOR_99 andSize:CGSizeMake(KAutoAcale(18), KAutoAcale(18))] forState:UIControlStateNormal];
    }
    return _upBtn;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    [_countLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.rightArrowImg.mas_left);
        make.centerY.mas_equalTo(self);
        make.height.mas_equalTo(44);
    }];
    [_rightArrowImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.contentView).mas_offset(-KPAND_DEF);
        make.centerY.mas_equalTo(self);
    }];
    
    [_editView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.contentView).mas_offset(-KPAND_DEF);
      
        make.centerY.mas_equalTo(self);
        make.height.mas_equalTo(44);
    }];
    
    [_deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.editView);
        make.centerY.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(35, 35));
    }];
    [_eidtBtn mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.mas_equalTo(self.deleteBtn.mas_left);
         make.centerY.mas_equalTo(self);
         make.size.mas_equalTo(CGSizeMake(35, 35));
     }];
    [_upBtn mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.mas_equalTo(self.eidtBtn.mas_left);
         make.centerY.mas_equalTo(self);
         make.size.mas_equalTo(CGSizeMake(35, 35));
     }];
    [_downBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.upBtn.mas_left);
        make.left.mas_equalTo(self.editView);
        make.centerY.mas_equalTo(self);
        make.size.mas_equalTo(CGSizeMake(35, 35));
    }];
}

@end
